package com.rede.didiok.common.feign;

import java.util.List;
import java.util.Map;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.rede.didiok.common.config.feign.FeignConfiguration;
import com.rede.didiok.common.dto.admin.SystemConfigDto;
import com.rede.didiok.common.dto.file.FileDto;
import com.rede.didiok.common.dto.file.PictureDto;
import com.rede.didiok.common.dto.file.PictureCategoryDto;
import com.rede.didiok.common.utils.R;


/**
 * didiok-file相关接口
 *
 */
@FeignClient(name = "didiok-user", contextId = "didiok-file0", configuration = FeignConfiguration.class)
public interface FileFeignClient {

    /**
     * 获取文件的信息接口
     *
     * @param fileIds 图片uid
     * @param code    分隔符
     * @return
     */
    @RequestMapping(value = "/file/feign/picture/getPicture", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getPicture(@RequestParam("fileIds") String fileIds, @RequestParam("code") String code);

    /**
     * 通过URL List上传图片
     *
     * @param fileVO
     * @return
     */
    @RequestMapping(value = "/file/feign/file/uploadPicsByUrl", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String uploadPicsByUrl(@RequestBody FileDto fileVO);


    /**
     * 初始化网盘容量大小
     * @param adminUid
     * @param maxStorageSize
     */
    @RequestMapping(value = "/file/feign/storage/initStorageSize", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String initStorageSize(@RequestParam("adminUid") String adminUid, @RequestParam("maxStorageSize") Long maxStorageSize);

    /**
     * 调整网盘容量大小
     * @param adminUid
     * @param maxStorageSize
     */
    @RequestMapping(value = "/file/feign/storage/editStorageSize", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String editStorageSize(@RequestParam("adminUid") String adminUid, @RequestParam("maxStorageSize") Long maxStorageSize);

    /**
     * 通过管理员uid列表获取存储信息
     * @param adminUidList
     * @return
     */
    @RequestMapping(value = "/file/feign/storage/getStorageByAdminUid", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getStorageByAdminUid(@RequestParam("adminUidList") List<String> adminUidList);

    /**
     * 获取文件列表
     * @param fileDto
     * @return
     */
    @RequestMapping(value = "/file/feign/file/getFileList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getFileList( @RequestBody FileDto fileDto);

    /**
     * 获取文件Map
     * @param fileVO
     * @return
     */
    @RequestMapping(value = "/file/feign/file/getFileListMap", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    Map<String, FileDto> getFileListMap(@RequestBody FileDto fileVO);

    /**
     *
     * @param systemConfigDto
     * @return
     */
    // TODO @RequestParam是从请求头中获取数据，主要用于GET请求，@RequestBody是从请求体中获取数据，主要用于POST请求。两者组合使用会不会有问题
    @RequestMapping(value = "/file/feign/file/batchDeleteBySystemConfig", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String batchDeleteFileSystemConfig(@RequestBody SystemConfigDto systemConfigDto);


    /**
     * 查询指定条件下的文件列表
     * @param fileDto
     * @return
     */
    @RequestMapping(value = "/file/feign/file/listFileByPage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getFilePage(@RequestBody FileDto fileDto);

    /**
     * 根据 fileUidList 查询文件
     * @param fileUidList
     * @return
     */
    @RequestMapping(value = "/file/feign/file/listFileByUids", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R listFileByUids(@RequestBody List<String> fileUidList);

    /**
     * 根据 fileUidList 查询文件
     * @param fileUidList
     * @return
     */
    @RequestMapping(value = "/file/feign/picture/getTopOne", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getTopOne();

    /**
     * 获取图片列表
     * @param pictureDto
     * @return
     */
    @RequestMapping(value = "/file/feign/picture/getList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getPicturePageList(@RequestBody PictureDto pictureDto);

    /**
     * 增加图片
     * @param pictureDtoList
     * @return
     */
    @RequestMapping(value = "/file/feign/picture/add", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String addPicture(@RequestBody List<PictureDto> pictureDtoList);

    /**
     * 删除图片
     * @param pictureDto
     * @return
     */
    @RequestMapping(value = "/file/feign/picture/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String deleteBatchPicture(@RequestBody PictureDto pictureDto);

    /**
     * 通过图片Uid将图片设为封面
     * @param pictureDto
     * @return
     */
    @RequestMapping(value = "/file/feign/picture/setCover", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String setPictureCover(PictureDto pictureDto);

    /**
     * 根据uid获取图片
     *
     * @param uid 图片uid
     * @return
     */
    @RequestMapping(value = "/file/feign/picture/getById", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getPictureById(@RequestParam("uid") String uid);

    /**
     * 根据uid更新图片
     *
     * @param pictureDto 图片
     * @return
     */
    @RequestMapping(value = "/file/feign/picture/updateById", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R updatePictureById(@RequestBody PictureDto pictureDto);

    /**
     * 获取图片分类列表
     *
     * @param pictureDto 图片
     * @return
     */
    @RequestMapping(value = "/file/feign/pictureCategory/getList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getPictureCategoryPageList(@RequestBody PictureCategoryDto pictureCategoryDto);

    /**
     * 增加图片分类
     *
     * @param pictureDto 图片
     * @return
     */
    @RequestMapping(value = "/file/feign/pictureCategory/add", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String addPictureSort(@RequestBody PictureCategoryDto pictureCategoryDto);

    /**
     * 编辑图片分类
     *
     * @param pictureDto 图片
     * @return
     */
    @RequestMapping(value = "/file/feign/pictureCategory/edit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String editPictureSort(@RequestBody PictureCategoryDto pictureCategoryDto);

    /**
     * 删除图片分类
     *
     * @param pictureDto 图片
     * @return
     */
    @RequestMapping(value = "/file/feign/pictureCategory/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String deletePictureSort(@RequestBody PictureCategoryDto pictureCategoryDto);

    /**
     * 置顶图片分类
     *
     * @param pictureDto 图片
     * @return
     */
    @RequestMapping(value = "/file/feign/pictureCategory/stick", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String stickPictureSort(@RequestBody PictureCategoryDto pictureCategoryDto);

    /**
     * 根据uid获取图片分类
     *
     * @param pictureDto 图片
     * @return
     */
    @RequestMapping(value = "/file/feign/pictureCategory/getPictureCategoryByUid", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getPictureCategoryByUid(String uid);
}